// CardItem.cs
using UnityEngine;
using System.Collections.Generic;

[System.Serializable]
public class CardItem : BaseItem
{
    public enum CardType { TERRAIN, ENEMY, TACTIC }
    public enum TerrainEffectType { HEAL_PER_TURN, DAMAGE_AMP, RESOURCE_BOOST }

    [Header("卡牌属性")]
    public CardType cardType;
    public List<CardCost> costs = new List<CardCost>();
    public GameObject visualPrefab;

    [Header("地形卡专属")]
    public TerrainEffectType terrainEffect;
    public float terrainEffectValue;

    [Header("敌人类卡专属")]
    public GameObject enemyPrefab;
    public List<ItemAffix> guaranteedAffixes;

    [Header("战术卡专属")]
    public int usesPerLoop = 1;
    public int loopCooldown;

    public override string GetTooltipText()
    {
        string tooltip = $"<b>{displayName}</b>\n{description}\n";
        tooltip += $"卡牌类型: {cardType}\n";

        if (costs.Count > 0)
        {
            tooltip += "消耗: ";
            foreach (var cost in costs)
                tooltip += $"{cost.amount}{cost.resourceType} ";
            tooltip += "\n";
        }

        switch (cardType)
        {
            case CardType.TERRAIN:
                tooltip += $"地形效果: {terrainEffect} ({terrainEffectValue})\n";
                break;

            case CardType.ENEMY:
                tooltip += $"生成敌人: {enemyPrefab.name}\n";
                break;

            case CardType.TACTIC:
                tooltip += $"使用次数/循环: {usesPerLoop}\n";
                tooltip += $"冷却循环: {loopCooldown}\n";
                break;
        }

        return tooltip;
    }
}
